Avoid possible memory corruption in xdgmime, fd.o bug 12512, reported by
authorMatthias Clasen <mclasen@redhat.com>
Wed, 16 Apr 2008 16:59:28 +0000 (16:59 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 16 Apr 2008 16:59:28 +0000 (16:59 +0000)
2008-04-16  Matthias Clasen  <mclasen@redhat.com>

        Avoid possible memory corruption in xdgmime, fd.o bug 12512,
        reported by Joe Shaw and Federico Mena Quintero.

        * xdgmime.c(_xdg_mime_media_type_equal): Implement.
        (xdg_mime_media_type_equal): Turn into a wrapper around the
        _-prefixed version.

        * xdgmimecache.c: Use the _-prefixed versions of
        comparison functions throughout.

svn path=/trunk/; revision=20009

gtk/xdgmime/ChangeLog
gtk/xdgmime/xdgmime.c
gtk/xdgmime/xdgmimecache.c

index cdff403cffe89c0a65b6eb0a91cbf69053b841a8..d1c2775ac84f1837aa6e65d5e343b742aaf3b27e 100644 (file)
@@ -1,3 +1,15 @@
+2008-04-16  Matthias Clasen  <mclasen@redhat.com>
+
+       Avoid possible memory corruption in xdgmime, fd.o bug 12512,
+       reported by Joe Shaw and Federico Mena Quintero.
+
+       * xdgmime.c(_xdg_mime_media_type_equal): Implement.
+       (xdg_mime_media_type_equal): Turn into a wrapper around the
+       _-prefixed version.
+
+       * xdgmimecache.c: Use the _-prefixed versions of
+       comparison functions throughout.
+
 2008-02-16  Matthias Clasen  <mclasen@redhat.com>
 
        * === Released 2.13.0 ===
index 1d2007cb78a97dc70d93bf5337362baf151a60d3..d344b586da343cb58677bf9704fe228e615740c6 100644 (file)
@@ -670,13 +670,11 @@ xdg_mime_mime_type_equal (const char *mime_a,
 }
 
 int
-xdg_mime_media_type_equal (const char *mime_a,
-                          const char *mime_b)
+_xdg_mime_media_type_equal (const char *mime_a,
+                           const char *mime_b)
 {
   char *sep;
 
-  xdg_mime_init ();
-
   sep = strchr (mime_a, '/');
   
   if (sep && strncmp (mime_a, mime_b, sep - mime_a + 1) == 0)
@@ -685,6 +683,15 @@ xdg_mime_media_type_equal (const char *mime_a,
   return 0;
 }
 
+int
+xdg_mime_media_type_equal (const char *mime_a,
+                          const char *mime_b)
+{
+  xdg_mime_init ();
+
+  return _xdg_mime_media_type_equal (mime_a, mime_b);
+}
+
 #if 1
 static int
 xdg_mime_is_super_type (const char *mime)
index 8804eab51f3542f7058a71e75243eeff8ab6d11f..e4773133d8893326fea790ec335865829c8d40ec 100644 (file)
@@ -297,7 +297,7 @@ cache_magic_lookup_data (XdgMimeCache *cache,
          for (n = 0; n < n_mime_types; n++)
            {
              if (mime_types[n] && 
-                 xdg_mime_mime_type_equal (mime_types[n], non_match))
+                 _xdg_mime_mime_type_equal (mime_types[n], non_match))
                mime_types[n] = NULL;
            }
        }
@@ -783,7 +783,7 @@ _xdg_mime_cache_mime_type_subclass (const char *mime,
 #if 1
   /* Handle supertypes */
   if (is_super_type (ubase) &&
-      xdg_mime_media_type_equal (umime, ubase))
+      _xdg_mime_media_type_equal (umime, ubase))
     return 1;
 #endif